"""
time: 2024/10/24
title: Features
message:
辅助工具函数
"""
import socket


class Features:
    def __init__(self):
        pass

    @staticmethod
    def get_ip():
        """
        返回本机IP地址
        :return:
        """
        try:
            # 获取本地主机名
            hostname = socket.gethostname()
            # 获取本地IP
            ip_address = socket.gethostbyname(hostname)
        except socket.error as e:
            print(f"Unable to get IP Address: {e}")
            ip_address = '0.0.0.0'
        return ip_address
